<template>
  <simple-table
    :url-list="urlList"
    :current-use-btn-list="currentUseBtnList"
    :filed-property-list="filedPropertyList"
    submit-form-title="混凝土信息"
    table-name="materialConcrete"
  >
  </simple-table>
</template>

<script lang="ts" setup>
import { TableUrl } from "@/models/TableSetting";
import SimpleTable from "@/components/table/simple/SimpleTable.vue";
import { BtnNameEnum } from "@/components/table/simple/BtnNameEnum";
import { RuleEnum } from "@/components/form/basic/FormEnum";

const urlList = {
  refreshUrl: "/basic-request/MaterialConcrete/search",
  modifyingSingleUrl: "/basic-request/MaterialConcrete",
  modifyingBatchUrl: "/basic-request/MaterialConcrete/batch",
  deleteUrl: "/basic-request/MaterialConcrete/batch-delete",
} as TableUrl;

// 当前页面使用的功能按钮
const currentUseBtnList: BtnNameEnum[] = [
  BtnNameEnum.ADD,
  BtnNameEnum.REFRESH,
  BtnNameEnum.DELETE,
  BtnNameEnum.BATCH_IMPORT,
  BtnNameEnum.BATCH_IMPORT_TEMPLATE,
];

const filedPropertyList = [
  {
    filedName: "id",
    label: "ID",
    span: 8,
    width: 100,
    minWidth: 100,
    showInTable: false,
    showInForm: false,
    formType: "el-form-text",
  },
  {
    filedName: "no",
    label: "混凝土编码",
    width: 220,
    minWidth: 120,
    showInTable: true,
    showInForm: true,
    formType: "el-form-text",
    rules: [
      {
        ruleName: RuleEnum.REQUIRED,
        ruleValue: true,
        message: "混凝土编码不能为空",
      },
    ],
  },
  {
    filedName: "name",
    label: "混凝土名称",
    width: 220,
    minWidth: 120,
    showInTable: true,
    showInForm: true,
    formType: "el-form-text",
    rules: [
      {
        ruleName: RuleEnum.REQUIRED,
        ruleValue: true,
        message: "混凝土名称不能为空",
      },
    ],
  },
  {
    filedName: "categoryName",
    label: "物料类别名称",
    width: 220,
    minWidth: 120,
    showInTable: true,
    showInForm: true,
    formType: "el-form-text",
    rules: [
      {
        ruleName: RuleEnum.REQUIRED,
        ruleValue: true,
        message: "物料类别名称不能为空",
      },
    ],
  },
  {
    filedName: "unit",
    label: "计量单位",
    width: 220,
    minWidth: 120,
    showInTable: true,
    showInForm: true,
    formType: "el-form-text",
    rules: [
      {
        ruleName: RuleEnum.REQUIRED,
        ruleValue: true,
        message: "计量单位不能为空",
      },
    ],
  },
  {
    filedName: "price",
    label: "单价",
    width: 220,
    minWidth: 120,
    showInTable: true,
    showInForm: true,
    formType: "el-form-text",
    rules: [
      {
        ruleName: RuleEnum.REQUIRED,
        ruleValue: true,
        message: "单价不能为空",
      },
    ],
  },
  {
    filedName: "safetyStock",
    label: "安全库存下限",
    width: 220,
    minWidth: 120,
    showInTable: true,
    showInForm: true,
    formType: "el-form-text",
    rules: [
      {
        ruleName: RuleEnum.REQUIRED,
        ruleValue: true,
        message: "安全库存下限不能为空",
      },
    ],
  },
  {
    filedName: "safetyStockUp",
    label: "安全库存上限",
    width: 220,
    minWidth: 120,
    showInTable: true,
    showInForm: true,
    formType: "el-form-text",
    rules: [
      {
        ruleName: RuleEnum.REQUIRED,
        ruleValue: true,
        message: "安全库存上限不能为空",
      },
    ],
  },
  {
    filedName: "spec",
    label: "规格",
    width: 220,
    minWidth: 120,
    showInTable: true,
    showInForm: true,
    formType: "el-form-text",
  },
  {
    filedName: "description",
    label: "描述",
    width: 220,
    minWidth: 120,
    showInTable: true,
    showInForm: true,
    formType: "el-form-text",
  },
  {
    filedName: "createUser",
    label: "创建人",
    span: 8,
    minWidth: 220,
    showInTable: true,
    showInForm: false,
    formType: "el-form-text",
  },
  {
    filedName: "createGmt",
    label: "创建时间",
    span: 8,
    minWidth: 230,
    showInTable: true,
    showInForm: false,
    formType: "el-form-picker-date",
  },
  {
    filedName: "modifiedUser",
    label: "修改人",
    span: 8,
    minWidth: 220,
    showInTable: true,
    showInForm: false,
    formType: "el-form-text",
  },
  {
    filedName: "modifiedGmt",
    label: "修改时间",
    span: 8,
    minWidth: 230,
    showInTable: true,
    showInForm: false,
    formType: "el-form-picker-date",
  },
];
</script>

<style scoped></style>
